package org.jeecg.common.util;

import cn.hutool.core.lang.Snowflake;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Yann
 * @date 2019/9/12
 * @description 生成唯一ID工具类
 */
public class IDUtil {
    private final static Snowflake snowflake = new Snowflake(0,0);

    public static Long getNewId(){
        return snowflake.nextId();
    }

    public static List<Long> getNewIds(Integer number){
        List<Long> ids = new ArrayList<>(number);
        for (int i=0; i<number; i++){
            ids.add(snowflake.nextId());
        }
        return ids;
    }

}
